import {DrawFactory} from "@/business/factory/draw.factory";
import {Panel} from "@/business/entity/panel/panel.entity";
import {RectangleGraph} from "@/business/entity/graph/rectangle.graph.entity";
import type {Graph} from "@/business/entity/graph/graph.entity";
import {Coordinate} from "@/business/entity/coordinate/coordinate.entity";
import {CircleGraph} from "@/business/entity/graph/circle.graph.entity";
import {OvalGraph} from "@/business/entity/graph/oval.graph.entity";
import {DiamondGraph} from "@/business/entity/graph/diamond.graph.entity";
import {Style} from "@/business/entity/style/style.entity";
import {
    CircleGraphServiceImpl,
    DiamondGraphServiceImpl,
    OvalGraphServiceImpl,
    RectangleGraphServiceImpl
} from "@/business/service/graph.service";
import type {GraphService} from "@/business/interface/graph.interface";

/**
 *  绘图业务处理类
 * @author JiangXincan
 * @date 2020/5/19 13:38
 */
export class BusinessManage {

    /**
     * 绘图处理
     * @param id 绘图结果绑定的canvas id标识
     */
    public static image(id: string) {
        // 绘制画布
        const panel: Panel = new Panel(id, 960, 1080, "#155dee");

        // 创建绘图工厂
        const drawFactory: DrawFactory = new DrawFactory(panel);

        // 构造矩形对象、绘图对象（默认值，没有自己的特性）
        const rectangleGraph: Graph = new RectangleGraph("rectangleGraph", new Coordinate(250, 150), new Style(300, 180, 1, '#003397'));
        drawFactory.draw(rectangleGraph);

        // 构造圆型对象、绘图对象（有半径）
        const circleGraph: Graph = new CircleGraph("circleGraph", new Coordinate(700, 150), 100, new Style(0, 0, 1, 'hotpink'));
        drawFactory.draw(circleGraph);

        // 构造椭圆对象、绘图对象（默认值，没有自己的特性）
        const ovalGraph: Graph = new OvalGraph("ovalGraph", new Coordinate(250, 500), new Style(150, 100, 1, '#13c3ed'));
        drawFactory.draw(ovalGraph);

        // 构造菱形对象、绘图对象（默认值，没有自己的特性）
        const diamondGraph: Graph = new DiamondGraph("diamondGraph", new Coordinate(600, 500), new Style(200, 300,1, 'orange'));
        drawFactory.draw(diamondGraph);

    }
}